/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="goods_sku")
public class GoodsSku implements Serializable {
	public GoodsSku() {
	}
	
	private int id;
	
	private cn.imvc.app.entities.Goods goods;
	
	private String specName;
	
	private String specId;
	
	private String subTitle;
	
	private Integer inventory;
	
	private Integer click;
	
	private Integer salenum;
	
	private Integer collect;
	
	private Byte state;
	
	@Version	
	private Integer version;
	
	private Integer weight;
	
	private Integer points;
	
	private java.util.Set goodsOrder = new java.util.HashSet();
	
	private java.util.Set comments = new java.util.HashSet();
	
	private java.util.Set cart = new java.util.HashSet();
	
	private java.util.Set favorites = new java.util.HashSet();
	
	private java.util.Set goodsPrice = new java.util.HashSet();
	
	private java.util.Set inventoryFlow = new java.util.HashSet();
	
	public void setId(int value) {
		this.id = value;
	}
	
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_GOODSSKU_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_GOODSSKU_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	/**
	 * 规格 格式（规格类名:规格值;规格类名:规格值）
	 */
	public void setSpecName(String value) {
		this.specName = value;
	}
	
	/**
	 * 规格 格式（规格类名:规格值;规格类名:规格值）
	 */
	@Column(name="specName", nullable=true, length=255)	
	public String getSpecName() {
		return specName;
	}
	
	/**
	 * 规格 格式（规格类名id:规格值id;规格类名id:规格值id）
	 */
	public void setSpecId(String value) {
		this.specId = value;
	}
	
	/**
	 * 规格 格式（规格类名id:规格值id;规格类名id:规格值id）
	 */
	@Column(name="specId", nullable=true, length=255)	
	public String getSpecId() {
		return specId;
	}
	
	/**
	 * 子标题
	 */
	public void setSubTitle(String value) {
		this.subTitle = value;
	}
	
	/**
	 * 子标题
	 */
	@Column(name="subTitle", nullable=true, length=255)	
	public String getSubTitle() {
		return subTitle;
	}
	
	public void setInventory(int value) {
		setInventory(new Integer(value));
	}
	
	public void setInventory(Integer value) {
		this.inventory = value;
	}
	
	@Column(name="inventory", nullable=true, length=10)	
	public Integer getInventory() {
		return inventory;
	}
	
	/**
	 * 点击次数
	 */
	public void setClick(int value) {
		setClick(new Integer(value));
	}
	
	/**
	 * 点击次数
	 */
	public void setClick(Integer value) {
		this.click = value;
	}
	
	/**
	 * 点击次数
	 */
	@Column(name="click", nullable=true, length=10)	
	public Integer getClick() {
		return click;
	}
	
	/**
	 * 销售数量
	 */
	public void setSalenum(int value) {
		setSalenum(new Integer(value));
	}
	
	/**
	 * 销售数量
	 */
	public void setSalenum(Integer value) {
		this.salenum = value;
	}
	
	/**
	 * 销售数量
	 */
	@Column(name="salenum", nullable=true, length=10)	
	public Integer getSalenum() {
		return salenum;
	}
	
	/**
	 * 收藏数量
	 */
	public void setCollect(int value) {
		setCollect(new Integer(value));
	}
	
	/**
	 * 收藏数量
	 */
	public void setCollect(Integer value) {
		this.collect = value;
	}
	
	/**
	 * 收藏数量
	 */
	@Column(name="collect", nullable=true, length=11)	
	public Integer getCollect() {
		return collect;
	}
	
	/**
	 * 商品状态 0下架，1正常
	 */
	public void setState(byte value) {
		setState(new Byte(value));
	}
	
	/**
	 * 商品状态 0下架，1正常
	 */
	public void setState(Byte value) {
		this.state = value;
	}
	
	/**
	 * 商品状态 0下架，1正常
	 */
	@Column(name="state", nullable=true)	
	public Byte getState() {
		return state;
	}
	
	/**
	 * 版本号
	 */
	public void setVersion(int value) {
		setVersion(new Integer(value));
	}
	
	/**
	 * 版本号
	 */
	public void setVersion(Integer value) {
		this.version = value;
	}
	
	/**
	 * 版本号
	 */
	@Column(name="version", nullable=true, length=10)	
	@Version	
	public Integer getVersion() {
		return version;
	}
	
	public void setWeight(int value) {
		setWeight(new Integer(value));
	}
	
	public void setWeight(Integer value) {
		this.weight = value;
	}
	
	@Column(name="weight", nullable=true, length=10)	
	public Integer getWeight() {
		return weight;
	}
	
	public void setPoints(int value) {
		setPoints(new Integer(value));
	}
	
	public void setPoints(Integer value) {
		this.points = value;
	}
	
	@Column(name="points", nullable=true, length=10)	
	public Integer getPoints() {
		return points;
	}
	
	public void setGoods(cn.imvc.app.entities.Goods value) {
		this.goods = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.Goods.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="goodsId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.Goods getGoods() {
		return goods;
	}
	
	public void setGoodsOrder(java.util.Set value) {
		this.goodsOrder = value;
	}
	
	@OneToMany(mappedBy="goodsSku", targetEntity=cn.imvc.app.entities.GoodsOrder.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)	
	public java.util.Set getGoodsOrder() {
		return goodsOrder;
	}
	
	
	public void setComments(java.util.Set value) {
		this.comments = value;
	}
	
	@OneToMany(mappedBy="goodsSku", targetEntity=cn.imvc.app.entities.Comments.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)	
	public java.util.Set getComments() {
		return comments;
	}
	
	
	public void setCart(java.util.Set value) {
		this.cart = value;
	}
	
	@OneToMany(mappedBy="sku", targetEntity=cn.imvc.app.entities.Cart.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)	
	public java.util.Set getCart() {
		return cart;
	}
	
	
	public void setFavorites(java.util.Set value) {
		this.favorites = value;
	}
	
	@OneToMany(mappedBy="sku", targetEntity=cn.imvc.app.entities.Favorites.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)	
	public java.util.Set getFavorites() {
		return favorites;
	}
	
	
	public void setGoodsPrice(java.util.Set value) {
		this.goodsPrice = value;
	}
	
	@OneToMany(mappedBy="goodsSku", targetEntity=cn.imvc.app.entities.GoodsPrice.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)	
	public java.util.Set getGoodsPrice() {
		return goodsPrice;
	}
	
	
	public void setInventoryFlow(java.util.Set value) {
		this.inventoryFlow = value;
	}
	
	@OneToMany(mappedBy="goodsSku", targetEntity=cn.imvc.app.entities.InventoryFlow.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)	
	public java.util.Set getInventoryFlow() {
		return inventoryFlow;
	}
	
	
	public String toString() {
		return toString(false);
	}
	
	public String toString(boolean idOnly) {
		if (idOnly) {
			return String.valueOf(getId());
		}
		else {
			StringBuffer sb = new StringBuffer();
			sb.append("GoodsSku[ ");
			sb.append("Id=").append(getId()).append(" ");
			if (getGoods() != null)
				sb.append("Goods.Persist_ID=").append(getGoods().toString(true)).append(" ");
			else
				sb.append("Goods=null ");
			sb.append("SpecName=").append(getSpecName()).append(" ");
			sb.append("SpecId=").append(getSpecId()).append(" ");
			sb.append("SubTitle=").append(getSubTitle()).append(" ");
			sb.append("Inventory=").append(getInventory()).append(" ");
			sb.append("Click=").append(getClick()).append(" ");
			sb.append("Salenum=").append(getSalenum()).append(" ");
			sb.append("Collect=").append(getCollect()).append(" ");
			sb.append("State=").append(getState()).append(" ");
			sb.append("Version=").append(getVersion()).append(" ");
			sb.append("Weight=").append(getWeight()).append(" ");
			sb.append("Points=").append(getPoints()).append(" ");
			sb.append("GoodsOrder.size=").append(getGoodsOrder().size()).append(" ");
			sb.append("Comments.size=").append(getComments().size()).append(" ");
			sb.append("Cart.size=").append(getCart().size()).append(" ");
			sb.append("Favorites.size=").append(getFavorites().size()).append(" ");
			sb.append("GoodsPrice.size=").append(getGoodsPrice().size()).append(" ");
			sb.append("InventoryFlow.size=").append(getInventoryFlow().size()).append(" ");
			sb.append("]");
			return sb.toString();
		}
	}
	
}
